﻿namespace MicroCloud.Authorization
{
    #region "定义数据权限服务"
    /// <summary>
    /// 定义数据权限服务
    /// </summary>
    public interface IDataAuthService
    {
        #region "方法"
        #region "获取指定实体的数据权限过滤表达式"
        /// <summary>
        /// 获取指定实体的数据权限过滤表达式
        /// </summary>
        /// <typeparam name="TEntity">实体类型</typeparam>
        /// <param name="operation">数据权限操作</param>
        /// <param name="group">
        /// 传入的查询条件组
        /// <para>为空时则只返回数据权限过滤器</para>
        /// </param>
        /// <returns>实体的数据权限过滤表达式</returns>
        Expression<Func<TEntity, bool>> GetDataFilter<TEntity>(DataAuthOperation operation, FilterGroup group = null);
        #endregion
        #region "检查指定操作的数据权限，验证要操作的数据是否符合特定的验证委托"
        /// <summary>
        /// 检查指定操作的数据权限
        /// <para>验证要操作的数据是否符合特定的验证委托</para>
        /// </summary>
        /// <typeparam name="TEntity">实体类型</typeparam>
        /// <param name="operation">数据权限操作</param>
        /// <param name="entities">待检测的实体数据</param>
        /// <returns>是否有权限</returns>
        bool CheckDataAuth<TEntity>(DataAuthOperation operation, params TEntity[] entities);
        #endregion

        #endregion

    }
    #endregion

}
